package sqldbManagement.dbparklot.mapper;

import sqldbManagement.dbparklot.cj.anno.Insert;
import sqldbManagement.dbparklot.cj.anno.Select;
import sqldbManagement.dbparklot.cj.anno.Update;
import sqldbManagement.dbparklot.cj.model.Model;
import sqldbManagement.dbparklot.entity.Park;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

public interface ParkDao {

    @Select(value = "select * from car_park",type = Park.class)
    List<Park> getList();

    @Update("update car_park set park = ? where id = ?")
    int updatePark(boolean bl,Integer id);

    @Insert("insert into car_card(car_park_id,name,time) value(?,?,?)")
    int insertParkMsg(Integer id, String name, Timestamp time);

    @Select(value = "select * from car_card where name = ? AND price = -1",type = Model.class)
    Model getParkPrice(String name);

    @Update("update car_card set price = ? where car_park_id = ?")
    int updateParkMsg(BigDecimal peice, Integer id);

    @Select(value = "select * from car_card",type = Model.class)
    List<Model> getParkPriceAll();


}
